
setTimeout(function(){
	$("#business_Name").focus();
	$("#business_Name").rules("add",{
		remote: {
			url : 'qz/business/checkEditName?name='+$("#business_Name").val()+"&id="+getQueryString("id"),
			type: "get",
			dataType: "json", 
			dataFilter:function(data,type){
				return data=="false"?false:true;
			}
		}, 
		messages: {remote: "该业务名称已存在"}
		
	}); 
} , parseInt(Math.random() * 1000)); 

var app = angular.module('businessApp', []);



app.controller('businessController', function($scope, $http) {
	$scope.view=function(){
		$http.get(timestamp('qz/business/get/'+getQueryString("id"))).success(function (response) {
			$scope.business = response.data;
		});
	}
	
	$scope.view();
	$scope.refreshData=function(){
		$scope.view();
	}
	
	$scope.businessSave=function(){
	   if($("#myForm").valid()){
		   $http.put('qz/business/update/', $scope.business).success(function(){
			   redirectUrl("manage/business/","list.jsp");
           });
	   }
	}
	
	$scope.businessReset=function(){
		$scope.view();
	}
	
	$scope.businessCancle=function(){
		redirectUrl("manage/business/","list.jsp");
	}
});